package com.etc.dao.impl;

import com.etc.dao.TypeDao;
import com.etc.entity.GoodsType;
import com.etc.tools.DBUtil;
import com.etc.tools.PageData;

public class TypeDaoImpl implements TypeDao {

	@Override
	public PageData<GoodsType> getTypes(String keywords, int pageNo, int pageSize) {
		String sql = "SELECT typeid,typename,typeinfo,parentid FROM tbl_goodstype where typename like ?";
		return DBUtil.exQueryByPage(sql, GoodsType.class, pageNo, pageSize, "%" + keywords + "%");
	}

	@Override
	public boolean update(GoodsType type) {
		String sql = "update tbl_goodstype set typename=?,typeinfo=? where typeid=?";
		// TODO Auto-generated method stub
		return DBUtil.exUpdate(sql, type.getTypename(), type.getTypeinfo(), type.getTypeid()) > 0;
	}

}
